﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ECommerce.Library.Web;
using AutoGear.BLL;
using Entity;

/// <summary>
/// Summary description for SitePublicBasePage
/// </summary>
public class SitePublicBasePage : PublicBasePage
{
    public static string rootPath = string.Empty;

    private int _subCategoryId = 0;
    public int SubCategoryId
    {
        get { return this._subCategoryId; }
        set { this._subCategoryId = value; }
    }

    private bool _isCategoryPage = false;
    public bool IsCategoryPage
    {
        get { return this._isCategoryPage; }
        set { this._isCategoryPage = value; }
    }

    public SitePublicBasePage()
    {
        //
        // TODO: Add constructor logic here
        //
    }

    protected override void OnPreInit(EventArgs e)
    {
        base.OnPreInit(e);
        //Theme = "Default";
    }

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        rootPath = Page.ResolveUrl("~");
        Title = SiteSettings.SiteName;
    }

    public String SupplierId
    {
        get
        {
            try
            {

                return Page.RouteData.Values["partnerId"].ToString();
            }
            catch
            {
                return string.Empty;
            }
        }
    }

    public String _BrandImageUrl
    {
        get
        {
            if (HttpContext.Current.Session["_BrandImageUrl"] != null)
            {
                return HttpContext.Current.Session["_BrandImageUrl"].ToString();
            }
            else
            {
                return String.Empty;
            }
        }
        
    }

    public Int32 _PartnerID
    {
        get
        {
            if (HttpContext.Current.Session["_PartnerID"] != null)
            {
                return Convert.ToInt32(HttpContext.Current.Session["_PartnerID"].ToString());
            }
            else
            {
                return -1;
            }
        }
        set
        {
            HttpContext.Current.Session["_PartnerID"] = value;
        }

    }
}
